VERSION 5.00
Begin VB.Form frmNAMAG 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "NAMAG v0.4b"
   ClientHeight    =   7455
   ClientLeft      =   45
   ClientTop       =   675
   ClientWidth     =   3780
   BeginProperty Font 
      Name            =   "Verdana"
      Size            =   8.25
      Charset         =   0
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmNAMAG.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   ScaleHeight     =   7455
   ScaleWidth      =   3780
   StartUpPosition =   2  'CenterScreen
   Begin VB.ListBox List5 
      Appearance      =   0  'Flat
      BackColor       =   &H00000000&
      ForeColor       =   &H0000FF00&
      Height          =   1785
      ItemData        =   "frmNAMAG.frx":BBFB
      Left            =   1440
      List            =   "frmNAMAG.frx":BBFD
      TabIndex        =   26
      Top             =   7680
      Width           =   1215
   End
   Begin VB.ListBox List4 
      Appearance      =   0  'Flat
      BackColor       =   &H00000000&
      ForeColor       =   &H0000FF00&
      Height          =   1785
      ItemData        =   "frmNAMAG.frx":BBFF
      Left            =   120
      List            =   "frmNAMAG.frx":BC01
      TabIndex        =   25
      Top             =   7680
      Width           =   1215
   End
   Begin VB.Frame Frame4 
      Caption         =   "MAC Address Idents:"
      Height          =   3915
      Left            =   0
      TabIndex        =   12
      Top             =   2760
      Width           =   3765
      Begin VB.TextBox Text5 
         Appearance      =   0  'Flat
         Height          =   285
         Left            =   120
         Locked          =   -1  'True
         TabIndex        =   20
         Text            =   "N/A"
         Top             =   3500
         Width           =   3495
      End
      Begin VB.TextBox Text4 
         Appearance      =   0  'Flat
         Height          =   285
         Left            =   120
         Locked          =   -1  'True
         TabIndex        =   18
         Text            =   "N/A"
         Top             =   2950
         Width           =   3495
      End
      Begin VB.TextBox Text3 
         Appearance      =   0  'Flat
         Height          =   450
         Left            =   120
         MultiLine       =   -1  'True
         TabIndex        =   16
         Text            =   "frmNAMAG.frx":BC03
         Top             =   2260
         Width           =   3495
      End
      Begin VB.ListBox List3 
         Appearance      =   0  'Flat
         BackColor       =   &H00000000&
         ForeColor       =   &H0000FF00&
         Height          =   1785
         ItemData        =   "frmNAMAG.frx":BC07
         Left            =   1320
         List            =   "frmNAMAG.frx":BC09
         TabIndex        =   14
         Top             =   240
         Width           =   2295
      End
      Begin VB.ListBox List2 
         Appearance      =   0  'Flat
         BackColor       =   &H00000000&
         ForeColor       =   &H0000FF00&
         Height          =   1785
         ItemData        =   "frmNAMAG.frx":BC0B
         Left            =   120
         List            =   "frmNAMAG.frx":BC0D
         TabIndex        =   13
         Top             =   240
         Width           =   1215
      End
      Begin VB.Label Label8 
         Caption         =   "[Random Ident MAC]:"
         Height          =   255
         Left            =   120
         TabIndex        =   19
         Top             =   3250
         Width           =   3495
      End
      Begin VB.Label Label7 
         Caption         =   "[Ident]:"
         Height          =   255
         Left            =   120
         TabIndex        =   17
         Top             =   2720
         Width           =   3495
      End
      Begin VB.Label Label6 
         Caption         =   "[Company]:"
         Height          =   255
         Left            =   120
         TabIndex        =   15
         Top             =   2030
         Width           =   3495
      End
   End
   Begin VB.Frame Frame3 
      Caption         =   "MAC Address List:"
      Height          =   1785
      Left            =   0
      TabIndex        =   10
      Top             =   960
      Width           =   3735
      Begin VB.TextBox Text2 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         Height          =   285
         Left            =   2520
         MaxLength       =   4
         TabIndex        =   23
         Text            =   "1024"
         Top             =   360
         Width           =   1095
      End
      Begin VB.CommandButton Command3 
         Caption         =   "&Generate"
         Height          =   435
         Left            =   2520
         TabIndex        =   22
         Top             =   720
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "&Save As"
         Enabled         =   0   'False
         Height          =   435
         Left            =   2520
         TabIndex        =   21
         Top             =   1200
         Width           =   1095
      End
      Begin VB.ListBox List1 
         Appearance      =   0  'Flat
         BackColor       =   &H00000000&
         ForeColor       =   &H0000FF00&
         Height          =   1395
         ItemData        =   "frmNAMAG.frx":BC0F
         Left            =   120
         List            =   "frmNAMAG.frx":BC11
         TabIndex        =   11
         Top             =   240
         Width           =   2295
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   "Generate #:"
         Height          =   255
         Left            =   2520
         TabIndex        =   24
         Top             =   120
         Width           =   1215
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "Status"
      Height          =   735
      Left            =   0
      TabIndex        =   7
      Top             =   6720
      Width           =   3765
      Begin VB.Label Label4 
         Caption         =   "[Generated MACs]: 0"
         Height          =   255
         Left            =   120
         TabIndex        =   9
         Top             =   240
         Width           =   3495
      End
      Begin VB.Label Label5 
         BackStyle       =   0  'Transparent
         Caption         =   "[Known Idents]: 0"
         Height          =   255
         Left            =   120
         TabIndex        =   8
         Top             =   480
         Width           =   3495
      End
   End
   Begin VB.Timer tmrCheck 
      Interval        =   1
      Left            =   3000
      Top             =   7920
   End
   Begin VB.Frame Frame1 
      Caption         =   "Config"
      Height          =   975
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   3765
      Begin VB.OptionButton Option3 
         Caption         =   "None"
         Height          =   255
         Left            =   2760
         TabIndex        =   6
         Top             =   600
         Width           =   855
      End
      Begin VB.OptionButton Option2 
         Caption         =   "-"
         Height          =   255
         Left            =   2160
         TabIndex        =   5
         Top             =   600
         Width           =   495
      End
      Begin VB.OptionButton Option1 
         Caption         =   ":"
         Height          =   255
         Left            =   1560
         TabIndex        =   4
         Top             =   600
         Value           =   -1  'True
         Width           =   495
      End
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         Height          =   285
         Left            =   1560
         Locked          =   -1  'True
         TabIndex        =   1
         Text            =   "oui.csv [not found]"
         Top             =   210
         Width           =   2055
      End
      Begin VB.Label Label2 
         Caption         =   "[MAC Style]:"
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   600
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "[MAC Idents]:"
         Height          =   255
         Left            =   120
         TabIndex        =   2
         Top             =   240
         Width           =   1335
      End
   End
   Begin VB.Menu mnuAbout 
      Caption         =   "&About"
   End
End
Attribute VB_Name = "frmNAMAG"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mIDstate As Boolean 'is "oui.csv" loaded or not?
Dim listVerMAC() As String
Dim mIdent As String 'this holds our ident
Dim xGen As Integer 'holds our random integer
Dim xMACg As String 'store our right side of mac address

Const kIdentStat = "[Known Idents]: " 'can be used to translate app?
Const gMacStat = "[Generated MACs]: " 'can be used to translate app?

Private Sub Command1_Click()
On Error Resume Next
Dim lngSave As Long
Set cdlg = CreateObject("MSComDlg.CommonDialog")

cdlg.Filter = "Text Files (.txt)|*.txt"
cdlg.filename = ""
cdlg.ShowSave
cdlg.DialogTitle = "Save List"

If LenB(cdlg.filename) = 0 Then Exit Sub

Dim filename As String
filename = cdlg.filename

If Option1.Value = True Then 'default list

Open filename$ For Output As #1
For lngSave& = 0 To List1.ListCount - 1
Print #1, List1.List(lngSave&)
Next lngSave&
Close #1
ElseIf Option2.Value = True Then

Open filename$ For Output As #1 '-
For lngSave& = 0 To List4.ListCount - 1
Print #1, Replace(List4.List(lngSave&), ":", "-") & "-" & Replace(List5.List(lngSave&), ":", "-")
Next lngSave&
Close #1

ElseIf Option3.Value = True Then
Open filename$ For Output As #1 'empty win7 standard
For lngSave& = 0 To List4.ListCount - 1
Print #1, Replace(List4.List(lngSave&), ":", "") & Replace(List5.List(lngSave&), "", "-")
Next lngSave&
Close #1

End If
MsgBox "Saved list as " & filename, , ""
End Sub

Private Sub Command3_Click()
On Error Resume Next
Dim xCnt As Long
Dim xMax As Integer
Dim xTXT As Long

List1.Clear

xMax = CInt(Text2.Text)

Text2.Enabled = False
Command3.Enabled = False
Command1.Enabled = False
xTXT = Text2.Text
xTXT = TrimAlpha(xTXT)
Text2.Text = TrimAlpha(Text2.Text)

If Len(Text2.Text) <= 0 Then
MsgBox "Please enter valid amount (Resetting Value)", vbCritical, ""
Text2.Enabled = True
Command3.Enabled = True
Command1.Enabled = True
Exit Sub
Else
List4.Clear 'clear backup ident
List5.Clear

If Option1.Value = True Then
Do Until xCnt = xMax
Randomize 'always random seed
xGen = Int(Rnd * List2.ListCount)
mIdent = List2.List(xGen)
xMACg = GenHex0(":")
List1.AddItem mIdent & ":" & xMACg 'no replace needed
List4.AddItem mIdent 'we make copy for porting out
List5.AddItem CStr(xMACg)
xCnt = xCnt + 1
Loop
ElseIf Option2.Value = True Then
Do Until xCnt = xMax
Randomize 'always random seed
xGen = Int(Rnd * List2.ListCount)
mIdent = List2.List(xGen)

List4.AddItem mIdent 'we make copy for porting out
xMACg = GenHex0(":")
List5.AddItem CStr(xMACg) 'save copy with standard format

List1.AddItem Replace(mIdent, ":", "-") & "-" & Replace(xMACg, ":", "-") 'replace : with -
'GenHex0("-")  'replace : with -
xCnt = xCnt + 1
Loop
ElseIf Option3.Value = True Then
Do Until xCnt = xMax
Randomize 'always random seed
xGen = Int(Rnd * List2.ListCount)
mIdent = List2.List(xGen)
List4.AddItem mIdent 'we make copy for porting out
xMACg = GenHex0(":")
List5.AddItem xMACg 'save copy with standard format

mIdent = Replace(mIdent, ":", "")
List1.AddItem mIdent & Replace(xMACg, ":", "") '
GenHex0 ("") 'replace : with nothing
xCnt = xCnt + 1
Loop
End If
End If
Text2.Enabled = True
Command3.Enabled = True
Command1.Enabled = True

End Sub

Private Sub Form_Load()
On Error Resume Next
    Dim sFile As String
    Dim X As String 'testing
    sFile = "oui.csv"
If Dir(sFile, vbNormal) = "" Then
mIDstate = False
'MsgBox "oui.csv" & vbNewLine & _
"Is not detected. Verifier won't work", vbCritical, ""
Else
mIDstate = True
    Open sFile For Input Access Read Shared As #1
    Do Until EOF(1)
    Line Input #1, X
    listVerMAC = Split(X, ",")
     List2.AddItem UCase(CStr(listVerMAC(0)))
     'myArray(X) = CStr(listVerMAC(0))
     List3.AddItem UCase(CStr(listVerMAC(1)))
    ' myArray2(X) = CStr(listVerMAC(1))
     Loop
    Close #1

    'listVert.ListIndex = listVert.ListIndex + 1
    End If
'Label6.Caption = kIdentStat
    DoEvents
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
Unload Me
End Sub


Private Sub List2_Click()
On Error Resume Next
List3.ListIndex = List2.ListIndex
Text4.Text = List2.Text
End Sub

Private Sub List3_Click()
On Error Resume Next
List2.ListIndex = List3.ListIndex
Text3.Text = List3.Text
If Option1.Value = True Then
Text5.Text = List2.Text & ":" & GenHex0(":") 'no replace needed
ElseIf Option2.Value = True Then
Text5.Text = Replace(CStr(List2.Text), ":", "-") & "-" & GenHex0("-")  'replace : with -
ElseIf Option3.Value = True Then
Text5.Text = Replace(CStr(List2.Text), ":", "") & GenHex0("") 'remove :
End If
End Sub

Private Sub mnuAbout_Click()
On Error Resume Next
MsgBox "NAMAG v0.4b" & vbNewLine & _
     "Which now generates only valid verified MAC Addresses" & vbNewLine & _
    "This is basically an improved version of NAMAG v0.2b", vbOKOnly, ""
End Sub

Private Sub tmrCheck_Timer()
If mIDstate = True Then
Text1.Text = "oui.csv [loaded]"
Command3.Enabled = True 'can generate
ElseIf mIDstate = False Then
Text1.Text = "oui.csv [not found]"
Command3.Enabled = False 'can't generate
End If
Label4.Caption = kIdentStat & CStr(List2.ListCount)
Label5.Caption = gMacStat & CStr(List1.ListCount)
End Sub
